###
 # @Author: 周广斌
 # @Date: 2024-03-12 19:36:08
 # @LastEditTime: 2024-03-13 21:35:38
 # @Description: TODO MySQL数据库
### 
# 开启MySQL镜像
docker run -p 3306:3306 --name mysql \
-v /data/mysql/log:/var/log/mysql \
-v /data/mysql/data:/var/lib/mysql \
-v /data/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=root \
-d mysql:5.7
# 编辑MySQL配置文件
sudo tee /data/mysql/conf/my.cnf <<-'EOF'

# mysql配置
[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
init_connect='SET conllation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
EOF
# 重启MySQL
docker restart mysql

